package After826.ChatRoom;

import javax.xml.crypto.Data;
import java.io.*;
import java.net.Socket;
import java.net.UnknownHostException;

public class TestSockClient {
    public static void main(String[] args) {
        InputStream is = null;
        OutputStream os = null;
        String s = null;
        try{
            Socket socket = new Socket("localhost",8888);
            is = socket.getInputStream();
            os = socket.getOutputStream();
//            DataInputStream dis = new DataInputStream(is);
//            DataOutputStream dos = new DataOutputStream(os);
            BufferedInputStream dis = new BufferedInputStream(is);
            BufferedOutputStream dos = new BufferedOutputStream(os);

            dis.append("客户端提交服务器");
            //客户端向服务器端发送请求的内容
            dos.writeUTF(string.toString());
            if(dis.read() != null)
                System.out.println(s); 
            dos.close();
            dis.close();
            socket.close();
        }catch(UnknownHostException e){
            e.printStackTrace();
        }catch(IOException e){
            e.printStackTrace();
        }
    }
}